﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Twodi.Aspect.Interfaces;
using Microsoft.Xna.Framework;

namespace Twodi.Behavior.Implemented
{
    public class RotationBehavior : AbstractBehavior<IRotationAspect>
    {
        public float Multiplier { get; set; }

        public bool Clockwise { get; set; }

        public RotationBehavior(IRotationAspect component)
            : base(component)
        {
            Clockwise = true;
            Multiplier = 1f;
        }

        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            // TODO: Add your game logic here.

            if (Clockwise)
            {
                this.Component.RotationProperties.Rotation += (float)gameTime.ElapsedGameTime.TotalSeconds * Multiplier;
            }
            else
            {
                this.Component.RotationProperties.Rotation -= (float)gameTime.ElapsedGameTime.TotalSeconds * Multiplier;
            }

            float circle = MathHelper.Pi * 2;
            this.Component.RotationProperties.Rotation = this.Component.RotationProperties.Rotation % circle;
        }

        public override void Initialize()
        {

        }

        public override void Draw(GameTime gameTime)
        {

        }

        public override bool Handle(Input.KeyboardInput input)
        {
            throw new NotImplementedException();
        }

        public override bool Handle(Input.MouseInput input)
        {
            throw new NotImplementedException();
        }
    }
}
